import request from '@/utils/request'

export function getDisUnits(params) {
  return request({
    url: 'api/sysDispatchUnit',
    method: 'get',
    data: params
  })
}

export function getTypeNames(params) {
  return request({
    url: 'api/dictDetail/getType',
    method: 'post',
    data: params
  })
}

export function add(data) {
  return request({
    url: 'api/sysDispatchUnit',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/sysDispatchUnit',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/sysDispatchUnit',
    method: 'put',
    data
  })
}

export function get(id) {
  return request({
    url: 'api/sysDispatchUnit/' + id,
    method: 'get'
  })
}

export function selectShortName() {
  return request({
    url: 'api/sysDispatchUnit/getShortName',
    method: 'get'
  })
}

export function getFirstNode(params) {
  return request({
    url: 'api/sysDispatchUnit/getFirstNode',
    method: 'get',
    params
  })
}

export default { add, del, edit, get, selectShortName, getTypeNames, getDisUnits, getFirstNode }
